#include <string.h>
#include <stdlib.h>
#include "q_common.h"



int q_hashname(const char* name)
{
	int hash = 0;
	if(!name)
		return 0;
	for(; *name; ++name)
		hash += *name;
	hash %= Q_HASH_TABLE_SIZE;
	return hash;
}

int q_prepstring(char* str, int size, const char* start, const char* end)
{
	if(size <= 0 || end < start || end - start + 1 > size)
		return Q_STATUS_FATAL;
	memset(str, 0, size);
	strncpy(str, start, size);
	return Q_STATUS_OK;
}
